package com.best.guanfengji.base

import android.app.Dialog
import android.os.Bundle
import androidx.fragment.app.DialogFragment
import com.best.guanfengji.base.weakdialog.WeakDialog

open class BaseDialogFragment:DialogFragment() {

    /**
     * 用弱引用来防止Message中打开dialog内存泄漏
     */
    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
        return WeakDialog(requireContext(),theme)
    }


//    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
//        dialog?.window?.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE)
//        super.onViewCreated(view, savedInstanceState)
//        dialog?.setOnShowListener {
//            dialog?.window?.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE)
//            dialog?.window?.let { it1 ->
//                BarUtils.setNavBarVisibility(it1,false)
//                KeyboardUtils.registerSoftInputChangedListener(it1) {
//                    BarUtils.setNavBarVisibility(it1,false)
//                }
//            }
//        }
//    }

}